import React, {Component} from "react";
import {Image, Text, View, Picker, Button} from "@tarojs/components";
import { AtButton, AtSteps, AtCard,AtTag } from 'taro-ui'
import Taro from "@tarojs/taro";

import "taro-ui/dist/style/components/flex.scss";
import "taro-ui/dist/style/components/tag.scss";
import "taro-ui/dist/style/components/card.scss";
import './intelligentGuidance4.less'


class IntelligentGuidance4 extends Component{
  constructor () {
    super(...arguments)
    var today = new Date(),
      date = today.getFullYear() + '-' + (today.getMonth() + 1) + '-' + today.getDate();
    this.state = {
      value: '',
      current: 3,
      dateSel: date,//出生日期
      sexList: ['男', '女'],
      num: '0',
      sex: '男',
      inteTreatInfo: {
        sex: '',
        birth: '',
        uncomfotable: ''
      }
    }
  }

  componentDidMount() {
    Taro.getStorage({
      key: '__userInfo__',
      success:(res)=> {
        this.setState({
          value: res.data.nickName
        })
      }
    })
  }


  handleChange (value) {
    this.setState({
      value
    })
    return value
  }

  onChange (current) {
    this.setState({
      current
    })
  }

  onDateChange = e => {
    this.setState({
      dateSel: e.detail.value
    })
  }

  changeSex(index, gender){
    this.setState({
      num: index,
      sex: gender
    });
  }

  /*点击完成*/
  toIndex(){
    Taro.reLaunch({url: '/pages/myIndex/myIndex'});
  }

  /*点击重新测试*/
  toIntelligentGuidance(){
    Taro.reLaunch({url: '/pages/intelligentGuidance/intelligentGuidance'});
  }

  render(){
    const items = [
      {title: '已完成', status: 'success'},
      {title: '已完成', status: 'success'},
      {title: '已完成', status: 'success'},
      {title: '进行中', status: '',icon:{
          value: 'chevron-down',
          activeColor: '#ff3041',
          inactiveColor: '#563cfa',
          size: '16',}}
    ]
    return(
      <View>
        <View className='mar-step'>
          <AtSteps
            items={items}
            current={this.state.current}
            onChange={this.onChange.bind(this)}
          />
        </View>
        <View >
        <AtCard
          className='card'
          title='您可能的病症（仅供参考使用）'
        >
          <View className='init-card '>
            <AtTag type='primary'  >感冒病（风寒束表证）</AtTag><Text >90%</Text>
          </View>
          <View className='init-card'>
            <AtTag type='primary' >咳嗽病（风寒束表证）</AtTag><Text>70%</Text>
          </View>
        </AtCard>
        </View>
        <View >
        <AtCard
          className='card'
          title='建议挂号'
        >
          <View className='init-card at-row'>
            <AtTag type='primary' className='at-col'>动东里社区卫生服务站</AtTag>
            <AtTag type='primary' className='at-col init-card-name'>张小萌</AtTag>
            <AtTag type='primary' className='at-col init-card-name'>汪大东</AtTag>
          </View>
          <View className='init-card'>
            <AtTag type='primary' >裕西社区卫生服务中心</AtTag>

          </View>
        </AtCard>
        </View>
        <View className='at-row h'>
          <AtButton className='again-btn' onClick={this.toIntelligentGuidance.bind(this)}>重新测试</AtButton>
          <AtButton type='primary' className='dia-btn' onClick={this.toIndex.bind(this)}>完成</AtButton>
        </View>
      </View>
    )
  }
}

export default IntelligentGuidance4
